package com.example.controller;

import com.example.client.ClientFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author zhanglei
 * http使用nacos
 */
@RestController
@RequestMapping("/client")
public class ClientController {

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private ClientFeignService clientFeignService;

    @GetMapping("/get")
    public String get() {
        String result = restTemplate.getForObject("http://nacos-server/run", String.class);
        return result;
    }

    @GetMapping("/feign/get")
    public String feignGet() {
        return clientFeignService.get();
    }
}
